﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DVSProject.Models.ReportModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>


<h2>Report from MVC</h2>
<script type="text/javascript">


    $(document).ready(function () {
        $(".dtp").datepicker();
    });

    function SimpleInNewWin() {
        window.open("../FromMvc/ShowSimple");
    }

    
    function GenericInNewWin() {
        var oParam = { "FromDate": "", "ToDate": "" };
        oParam.FromDate = $("#txtFromDate").val();
        oParam.ToDate = $("#txtToDate").val();
     
        $.ajax({
            url: '../../FromMvc/ShowGenericRptInNewWin',
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify(oParam),
            dataType: 'json',
            success: function () {
                window.open("../GenericReportViewer/ShowGenericRpt", 'mywindow', 'fullscreen=yes, scrollbars=auto');
            }, 
            error: function (jqXHR, exception) {
                alert('Error message.');
            }

        });



    }




</script>

<h2>Report from Action</h2>


 <% using (Html.BeginForm("ShowSimple", "FromMvc"))%>
<%{%>
     <p><strong> Simple Report</strong></p>
    <input type="submit" value="Show simple" />
    <input type="button" value="Show simple in New Window" onclick="SimpleInNewWin()"/>
 <% } %>

<% using( Html.BeginForm("ShowGeneric", "FromMVC"))%>
<%{%>
    <p><strong> Generic Report</strong>(With Data and Report Parameter)</p>
    <label>From</label>
    <input type="text" id="txtFromDate" name="txtFromDate" value="@DateTime.Now.ToShortDateString()" class="dtp" /> <label>To</label>
    <input type="text" id="txtToDate" name="txtToDate" value="" class="dtp"/> 
     <%-- <input type="text" id="Text1" name="txtFromDate" value="@DateTime.Now.ToShortDateString()" class="dtp" /> <label>To</label>
    <input type="text" id="Text2" name="txtToDate" value="@DateTime.Now.ToShortDateString()" class="dtp"/>--%>
     <%--  <%= Html.LabelFor(model => model.contract_start_date) %>
            <%= Html.TextBoxFor(model => model.contract_start_date, new { @class = "date" })%>
                <%= Html.ValidationMessageFor(model => model.contract_start_date)%>--%>
    <br />
    <input type="submit" value="Rpt from MVC" />
    <input type="button" value= "Rpt from MVC with new window" onclick="GenericInNewWin()" />
<% }%>
</asp:Content>
